package com.sti.platform.service.impl;

import org.activiti.engine.FormService;
import org.activiti.engine.HistoryService;
import org.activiti.engine.IdentityService;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.identity.Group;
import org.activiti.engine.repository.DeploymentBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aisino.core.server.BaseService;
import com.sti.platform.service.ActService;


@Service("actService")
public class ActServiceImpl extends BaseService implements ActService {

	
	@Autowired
	private ProcessEngine processEngine;
	
	@Autowired
	private RepositoryService repositoryService;

	@Autowired
	private RuntimeService runtimeService;

	@Autowired
	private FormService formService;

	@Autowired
	private IdentityService identityService;

	@Autowired
	private TaskService taskService;

	@Autowired
	private HistoryService historyService;

	@Autowired
	private ManagementService managementService;
	
	@Override
	public Group addGroup(){
		Group group=identityService.newGroup("1");
		group.setName("分组");
		group.setType("TPYE_A");
		identityService.saveGroup(group);
		return group;
		
	}
	
	@Override
	public void createDeployment(){
		
		DeploymentBuilder build=repositoryService.createDeployment();
	//	build.addZipInputStream(paramZipInputStream)
		build.addClasspathResource("MyProcess.bpmn");
		build.deploy();
		
	}
	
	public String  version(){
		String ver = ProcessEngine.VERSION;
		return ver;
		
	//	processEngine.VERSION;
	}
}
